package com.qfedu.controller;

import com.qfedu.pojo.ClinicpatientRegisteredClinic_users;
import com.qfedu.service.ClinicpatientRegisteredClinic_usersService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class ClinicpatientRegisteredClinic_usersContorller {
    @Resource
    private ClinicpatientRegisteredClinic_usersService clinicpatientRegisteredClinic_usersService;
//    连查全部挂号信息
    @ResponseBody
    @GetMapping("/getAll")
    public List<ClinicpatientRegisteredClinic_users> getAll(){
        return clinicpatientRegisteredClinic_usersService.getAll();
    }
//根据rid删除整条挂号信息
    @GetMapping("/delete")
    public boolean delete(int rid){
        return clinicpatientRegisteredClinic_usersService.delete(rid)>0;
    }
//    根据患者姓名查找整条挂号信息
    @ResponseBody
    @GetMapping("getAllByPname")
    public ClinicpatientRegisteredClinic_users getAllByPname(@RequestParam(value = "pname") String pname){
        return clinicpatientRegisteredClinic_usersService.getAllByPname(pname);
    }
}
